package com.cxc.mp.simple.plugins;

import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;

import java.util.Properties;

/**
 *  测试 自定义拦截器
 */

@Intercepts({@Signature(
        type= Executor.class, method = "update",
        args = {MappedStatement.class,Object.class})})
@Slf4j
public class MyInterceptor  implements Interceptor {


    @Override
    public Object intercept(Invocation invocation) throws Throwable {
        log.debug("-----针对修改进行拦截------------------");
        return invocation.proceed();
    }

    @Override
    public Object plugin(Object o) {
        return Plugin.wrap(o,this);
    }

    @Override
    public void setProperties(Properties properties) {

    }
}
